package com.gnote.repair.controller;

import com.gnote.repair.domain.LoginUser;
import com.gnote.repair.domain.ResponseResult;
import com.gnote.repair.domain.SysUser;
import com.gnote.repair.service.LoginService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Gnote
 * @since 2025/3/5 16:03
 */

@RestController
@RequiredArgsConstructor
public class LoginController {
    private final LoginService loginService;

    @PostMapping("/user/login")
    public String login(@RequestBody SysUser sysUser) {
        //登录
        return loginService.login(sysUser);
    }

    @PostMapping("/user/logout")
    public String logout() {
        //登出
        return loginService.logout();
    }

    /**
     * 注册
     */
    @PostMapping("/user/register")
    public ResponseResult<String> register(@RequestBody LoginUser loginUser) {
        //注册
        return loginService.register(loginUser);
    }



}
